<style>
    label{
        display:block;
        float:left;
        height:26px;
        line-height:15px;
        margin-right:20px;
        width:120px;
    }
</style>

<div class="grid_12">
    <div class="grid_5 alpha">
        <div class="icon_title"><span><?php echo $this->translator('customer_evaluation');?></span></div>
    </div>	
    <div class="t_a_bottom"><hr style="padding:0;"/></div>
    <div class="grid_10 t_a_bottom">
        <div class="clearfix t_a_bottom">
            <?php echo $this->translator('customer_evaluation_point');?>: <?php echo isset($this->avergePC->evaluation_point)?$this->avergePC->evaluation_point:0;?>
        </div>
        <div class="clearfix t_a_bottom">
            <?php echo $this->translator('customer_evaluation_counter');?>: <?php echo isset($this->avergePC->evaluation_counter)?$this->avergePC->evaluation_counter:0;?>
        </div>
    </div>
    <div class="grid_10" style="height:20px;">&nbsp;</div>

    <!--Tab-->
    <div class="subcolumns tabs pb10">
        <ul class="tabNavigation">
            <?php if($this->isEnterprise):?>
            <li><a href="#tab1" id="seller" val="" rel="seller"><?php echo $this->translator('customer_evaluation_seller')?></a></li>
            <?php endif;?>
            <li><a href="#tab2" id="buyer" val="" rel="buyer"><?php echo $this->translator('customer_evaluation_buyer')?></a></li>
        </ul>

        <?php if($this->isEnterprise):?>
        <div id="tab1">
            <div id="sellerOutput" class="grid_12"></div>
        </div>
        <?php endif;?>

        <div id="tab2" style="display: block;">
            <div id="buyerOutput" class="grid_12"></div>
        </div>
    </div>
    <!--end tab-->
</div>

<script type="text/javascript" charset="utf-8">
    $(function () {
        var tabContainers = $('div.tabs > div');
        tabContainers.hide().filter(':first').show();

        $('div.tabs ul.tabNavigation a').click(function () {
                tabContainers.hide();
                tabContainers.filter(this.hash).show();
                $('div.tabs ul.tabNavigation a').removeClass('selected');
                $(this).addClass('selected');
                return false;
        }).filter(':first').click();
    });
</script>
<script type="text/javascript">
$(document).ready(function() {

    $('div.tabs ul.tabNavigation a').click(function () {
        key = $(this).attr('rel');
        val = $(this).attr('val');
        if(key == 'buyer' && val != 'is_loaded'){
            buyerAjax();
        }
        else if(key == 'seller' && val != 'is_loaded'){
            sellerAjax();
        }
    });
    /**Auto load ajax*/
    <?php if($this->isEnterprise):?>
        sellerAjax();
    <?php else:?>
        buyerAjax();
    <?php endif;?>
});

function buyerAjax(){
    isEnterprise = '<?php echo $this->isEnterprise;?>';

    $("#buyerOutput").html('').addClass('t_a_ui_helper_loading');
    jQuery.ajaxq('buyer', {
        type: 'POST',
        url: "<?php echo $this->url(array('user_id' => $this->exp_id), 'customer_evaluation_buyer'); ?>",
        data: { isEnterprise:isEnterprise },
        success: function(html) {
            $("#buyerOutput").html('').removeClass('t_a_ui_helper_loading');
            $('#buyerOutput').html(html);

            /**
            * Set is loaded
            */
            $('#buyer').attr('val', 'is_loaded');
        }
    });
}

function sellerAjax(){
    $("#sellerOutput").html('').addClass('t_a_ui_helper_loading');
    jQuery.ajaxq('seller', {
        type: 'POST',
        url: "<?php echo $this->url(array('user_id' => $this->exp_id), 'customer_evaluation_seller'); ?>",
        data: {},
        success: function(html) {
            $("#sellerOutput").html('').removeClass('t_a_ui_helper_loading');
            $('#sellerOutput').html(html);

            /**
            * Set is loaded
            */
            $('#seller').attr('val', 'is_loaded');
        }
    });
}
</script>